java program to count the numbers